package com.wdcloud.framework_business.wight;

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.wdcloud.framework_business.R;

/**
 * Info:
 * Created by Umbrella.
 * CreateTime: 2021/3/5 14:31
 */
public class BaseHeadView extends RelativeLayout {
    public TextView tvLeft;
    public TextView tvCenter;
    public TextView tvRight;

    public ImageView ivLeft;
    public ImageView ivOvalLeft;
    public ImageView ivRight;

    private ViewGroup mRootView;
    private View statusPlaceView;

    private RelativeLayout rlContent;
    public BaseHeadView(Context context) {
        super(context);
        initView(context);
    }

    public BaseHeadView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    public BaseHeadView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }
    private void initView(Context context)
    {
        mRootView=(ViewGroup) LayoutInflater.from(context).inflate(R.layout.base_head_layout,null);
        tvCenter = (TextView) mRootView.findViewById(R.id.tv_center_title);
        tvCenter.setTypeface(null, Typeface.BOLD);
        tvRight = (TextView) mRootView.findViewById(R.id.tv_right_title);
        ivLeft = (ImageView) mRootView.findViewById(R.id.iv_left);
        ivRight = (ImageView) mRootView.findViewById(R.id.iv_right);
        ivOvalLeft = (ImageView) mRootView.findViewById(R.id.iv_oval_left);
        statusPlaceView = (View) mRootView.findViewById(R.id.status_place_view);
        rlContent = (RelativeLayout) mRootView.findViewById(R.id.content_rl);
    }
    public void setTitleStyle(ViewGroup viewGroup) {
        mRootView.removeAllViews();
        mRootView.addView(viewGroup);
    }


    public void setHeaderVisibility(int visibility) {
        mRootView.setVisibility(visibility);
    }

    public void isShowStatusPlaceView() {
        statusPlaceView.setVisibility(VISIBLE);
    }

    public RelativeLayout getRlContent() {
        return rlContent;
    }
}